package com.wao.product.service.mapper;

import com.wao.product.domain.*;
import com.wao.product.service.dto.BrandDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity Brand and its DTO BrandDTO.
 */
@Mapper(componentModel = "spring", uses = {})
public interface BrandMapper extends EntityMapper <BrandDTO, Brand> {

    @Mapping(source = "parent.id", target = "parentId")
    @Mapping(source = "parent.name", target = "parentName")
    BrandDTO toDto(Brand brand); 
    @Mapping(target = "children", ignore = true)

    @Mapping(source = "parentId", target = "parent")
    Brand toEntity(BrandDTO brandDTO); 
    default Brand fromId(Long id) {
        if (id == null) {
            return null;
        }
        Brand brand = new Brand();
        brand.setId(id);
        return brand;
    }
}
